using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Granite.Testing;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Granite.ComponentModel;
using Granite.Eventing;

namespace Granite.Commons.Tests
{
    public class ItemPropertyChangedEventAssert : EventAssert<RelayedEventArgs<PropertyChangedEventArgs>>
    {
        readonly INotifyItemPropertyChanged m_Source;

        public ItemPropertyChangedEventAssert(INotifyItemPropertyChanged source)
            : base(source)
        {
            m_Source = source;
            m_Source.ItemPropertyChanged += SourceEventFired;
        }

        public EventPair<RelayedEventArgs<PropertyChangedEventArgs>> Expect(object originalSender, string propertyName)
        {
			var nextEvent = Expect();
            Assert.AreSame(originalSender, nextEvent.EventArgs.OriginalSender, "The originalSender was not set correctly.");
            Assert.AreEqual(propertyName, nextEvent.EventArgs.EventArgs.PropertyName, "The wrong property name was set correctly.");
            return nextEvent;
        }

        

    }
}